package me.send.business.service.service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import me.send.business.service.bean.BrokerEvaluate;
import me.send.business.service.bean.UserEvaluateBean;
import me.send.business.service.mapper.BrokerEvaluateMapper;
import me.send.framework.util.HelperUtil;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class BrokerEvaluateService {
	@Autowired
	BrokerEvaluateMapper brokerEvaluateMapper;

	public int addEvaluate(BrokerEvaluate evaluate) {
		evaluate.setCreatetime(HelperUtil.getCurrentDate());
		evaluate.setUpdatetime(HelperUtil.getCurrentDate());
		return brokerEvaluateMapper.addUserEvaluate(evaluate);
	}

	public List<Map<String, Object>> getEvaluates(int brokerid) {
		return brokerEvaluateMapper.getEvaluates(brokerid);
	}

	public Map<String, Object> toEvaluate(int userid, int orderid) {
		Map<String, Object> params = new HashMap<String, Object>();
		params.put("userid", userid);
		params.put("orderid", orderid);
		return brokerEvaluateMapper.toEvaluate(params);
	}
	
	public List<UserEvaluateBean> myEvaluates(int userid,Long startid,int size){
		Map<String, Object> params = new HashMap<String, Object>();
		params.put("userid", userid);
		params.put("startid", startid);
		params.put("size", size);
		return brokerEvaluateMapper.myEvaluates(params);
	}
}
